// Copyright Epic Games, Inc. All Rights Reserved.

#pragma once

#include "GameplayTagContainer.h"
#include "LyraAbilityCost.h"
#include "ScalableFloat.h"

#include "LyraAbilityCost_ItemTagStack.generated.h"

struct FGameplayAbilityActivationInfo;
struct FGameplayAbilitySpecHandle;

class ULyraGameplayAbility;
class UObject;
struct FGameplayAbilityActorInfo;

/**
 * 表示一种消耗，需要消耗关联物品实例上的标签堆叠数量
 */
UCLASS(meta=(DisplayName="Item Tag Stack"))
class ULyraAbilityCost_ItemTagStack : public ULyraAbilityCost
{
	GENERATED_BODY()

public:
	ULyraAbilityCost_ItemTagStack();

	//~ULyraAbilityCost interface
	/**
	 * 检查能力消耗是否满足
	 * @param Ability 游戏能力对象
	 * @param Handle 能力规格句柄
	 * @param ActorInfo 演员信息
	 * @param OptionalRelevantTags 可选的相关标签容器
	 * @return 是否满足消耗条件
	 */
	virtual bool CheckCost(const ULyraGameplayAbility* Ability, const FGameplayAbilitySpecHandle Handle, const FGameplayAbilityActorInfo* ActorInfo, FGameplayTagContainer* OptionalRelevantTags) const override;
	/**
	 * 应用能力消耗
	 * @param Ability 游戏能力对象
	 * @param Handle 能力规格句柄
	 * @param ActorInfo 演员信息
	 * @param ActivationInfo 能力激活信息
	 */
	virtual void ApplyCost(const ULyraGameplayAbility* Ability, const FGameplayAbilitySpecHandle Handle, const FGameplayAbilityActorInfo* ActorInfo, const FGameplayAbilityActivationInfo ActivationInfo) override;
	//~End of ULyraAbilityCost interface

protected:
	/** 要消耗的标签数量（基于能力等级） */
	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category=Costs)
	FScalableFloat Quantity; // 可缩放浮点数，表示消耗数量

	/** 要消耗的标签 */
	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category=Costs)
	FGameplayTag Tag; // 游戏标签，表示要消耗的标签

	/** 如果无法应用此消耗，则返回的失败标签 */
	UPROPERTY(EditAnywhere, BlueprintReadOnly, Category=Costs)
	FGameplayTag FailureTag; // 游戏标签，表示失败时返回的标签
};